{template 'common/header'}

<ul class="nav nav-tabs">


	<li {if $operation== 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('unitSetting', array( 'op' => 'post'));}">户型添加</a></li>
	<li {if $operation== 'display'}class="active"{/if}><a
		href="{php echo $this->createWebUrl('unitSetting', array('op' => 'display'));}">户型管理</a></li>

</ul>
{if $operation == 'post'}
<div class="main">
	<form action="" method="post" class="form-horizontal form"
		enctype="multipart/form-data">
		<input type="hidden" name="id" value="{$item['id']}" />
		<p/>






		<div class="panel panel-default">
			<div class="panel-heading">
				户型设置
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 楼盘：</label>
					<div class="col-sm-9 col-xs-12">
						<select name="hid" class="form-control">
							{loop $houses $house}
							<option value="{$house['id']}" {if $house['id']==$item['hid'] }selected="selected"{/if}>{$house['title']}</option>
							{/loop}
						</select>
					</div>
				</div>




				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span>户型：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id="title" class="form-control span7"  placeholder="" name="tname" value="{$item['tname']}">
					</div>
				</div>


				<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 排序：</label>
				<div class="col-sm-9 col-xs-12">
					<input type="number" id="title" class="form-control span7"  placeholder="" name="sort" value="{$item['sort']}"> <label for="">(排序整数 页面展示按 序号从小到大排序)</label>
				</div>
			</div>


				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
					<div class="col-sm-9 col-xs-12">
						<input name="submit" type="submit" value="提交"
							   class="btn btn-primary span3"> <input type="hidden"
																	 name="token" value="{$_W['token']}" />
					</div>
				</div>









			</div>





		</div>














	</form>
</div>
<script type="text/javascript">
<!--
	//kindeditor($('.richtext-clone'));
//-->
</script>




{elseif $operation == 'display'}
<div class="main">


	<form action="" method="post" id="house_form">


		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">楼盘选择</label>
			<div class="col-sm-2 col-lg-2">

				<select name="hid" id="hid" class="form-control">
					{loop $houses $house}
							<option value="{$house['id']}" {if $house['id']==$hid}selected="selected"{/if}>{$house['title']}</option>
					{/loop}
				</select>
			</div>

		</div>


	</form>


	<div style="padding: 15px;">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style="min-width: 100px;">户型</th>
					<th style="min-width: 100px;">排序</th>
					<th style="text-align: right; min-width: 300px;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
					<td>
					
						{$item['tname']}
					
					</td>

					<td>

						{$item['sort']}

					</td>

				
				


					<td style="text-align: right; width: 400px">


						<a
								href="{php echo $this->createWebUrl('unitImgSetting', array('name' => 'mon_house', 'tid' => $item['id'], 'hid' => $item['hid']))}"
								title="户型图片" class="btn btn-small"><i class="glyphicon glyphicon-picture"></i>户型图片</a>

						<a
						href="{php echo $this->createWebUrl('unitSetting', array('name' => 'mon_house', 'id' => $item['id'], 'op' => 'post'))}"
						title="编辑" class="btn btn-small"><i class="glyphicon glyphicon-edit"></i>编辑</a> <a
						href="{php echo $this->createWebUrl('unitSetting', array('name' => 'mon_house', 'id' => $item['id'], 'op' => 'delete'))}"
						onclick="return confirm('此操作不可恢复，确认删除？');return false;" title="删除"
						class="btn btn-small"><i class="glyphicon glyphicon-remove"></i>删除</a></td>
				</tr>
				{/loop}
			</tbody>

		</table>
		{$pager}
	</div>
</div>

<script>
	$("#hid").change(function(){
		
		$("#house_form").submit();
	});
</script>
{/if} {template 'common/footer'}
